<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" th:with="title=${postDetail.postTitle},active='postDetail',hasEditor=true"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!-- head 头部-->
<head th:replace="web/common/fragment::head(${title},null,'')"></head>
	<body>

		<div th:replace="web/layout/header::header(${active})"></div>
		<!--	main	-->
		<div class="fly-main">
			<input type="hidden" id="parentId" value="-1" />
			<div class="layui-row clear layui-col-space15">
				<!--		articleDetail left	-->
				<div class="layui-col-md9">
					<div class="tiezi-main" style="padding-top: 0px !important;">
						<div class="tiezi-title">
							<h1 th:text="${postDetail.postTitle}">这里是标题，每个帖子都应该有一个非常吸引人的标题。
							</h1>
							<span th:replace="web/common/template::mark2(${postDetail})"></span>
							<!--<span class="do">
								>
							</span>-->
							<span class="do">
                                <i class="layui-icon layui-icon-down"></i>
								<div class="tiezi-setting">
                                    <li th:onclick="|doAccusation(${postDetail.postId})|">举报</li>
									<th:block shiro:hasRole="administrator" th:switch="${postDetail.postSupport==1}">
										<li th:case="true"  th:onclick="|doSupport(${postDetail.postId},0);|">取消精华</li>
										<li th:case="false"  th:onclick="|doSupport(${postDetail.postId},1);|">加精</li>
									</th:block>
									<th:block shiro:hasRole="administrator" th:switch="${postDetail.postTop==1}">
										<li th:case="true" th:onclick="|doTop(${postDetail.postId},0)|">取消置顶</li>
										<li th:case="false" th:onclick="|doTop(${postDetail.postId},1)|">置顶</li>
									</th:block>
                                    <li shiro:hasRole="administrator" th:onclick="|doDelete(${postDetail.postId})|">删除</li>
                                </div>
							</span>
						</div>

						<div class="tiezi-box main clear">
							<div class="left">
								<div class="landlord"></div>
								<div class="avatar">
									<a th:href="'/user/'+${postDetail.userId}" target="_blank">
										<span class="vip-icon" th:if="${postDetail.author.userGrade==1}"></span>
										<img th:src="${thUtil.formatUserImage(postDetail.author.userImg)}" class="avatar opacity" width="50" height="50">
										<i class="jinsom-verify jinsom-verify-a" title="至尊会员"></i>
									</a>
								</div>
								<div class="name"><a th:href="'/user/'+${postDetail.userId}" th:text="${postDetail.author.nickName}"
													 th:class="${postDetail.author.userGrade==1?'vipName':''}" target="_blank">克米</a></div>

								<div class="layui-bg-red info" th:if="${postDetail.author.userGrade}==1">
									<span>超级VIP</span>
								</div>
								<div class="layui-bg-black info" th:if="${postDetail.author.userGrade}==2">
									<span>至尊VIP</span>
								</div>
							</div>
							<div class="right">
								<div class="tiezi-box-content">
									<th:block th:utext="${postDetail.content.contentHtml}">
										此内容由系统生成。。。
									</th:block>
									<div class="tiezi-hide-content" th:if="${postDetail.hideContent!=null and postDetail.showHideContent}">
										<p th:utext="${postDetail.hideContent.content}">楼主一定是个大帅比！</p>
									</div>
									<div class="javabb-tips" th:if="${!postDetail.showHideContent and postDetail.postType==1}">
										<p>隐藏内容需要付费才可以看见</p>
										<p>售价：<span class="price" th:text="${postDetail.hideContent.price}"></span>元宝</p>
										<div class="buy-btn" th:onclick="|buyHideContent(${postDetail.hideContent.id},${postDetail.hideContent.price});|">购买</div>
									</div>
									<div class="javabb-tips" th:if="${!postDetail.showHideContent and postDetail.postType==2}">
										<p>隐藏内容需要登陆才可以看见</p>
										<div class="buy-btn" th:onclick="|showLoginForm()|">登陆</div>
									</div>
									<div class="javabb-tips" th:if="${!postDetail.showHideContent and postDetail.postType==3}">
										<p>隐藏内容需要评论才可以看见</p>
										<div class="buy-btn" onclick="$('html,body').animate({scrollTop:$('#tiezi-comment-editor-dom').offset().top}, 800);ue.focus();$('#parentId').val(-1);">立即评论</div>
									</div>

								</div>
								<div class="post-content-tail clear" th:utext="${config.postContentTail}">

								</div>
								<div class="tiezi-box-footer clear">
									<span th:text="${thUtil.formatPublishDate(postDetail.createTime)}">1周前</span>
									<span th:text="'阅读：'+${postDetail.clickCount}">阅读： 99999</span>
									<span>1楼</span>
									<span class="comment" onclick="$('html,body').animate({scrollTop:$('#tiezi-comment-editor-dom').offset().top}, 800);ue.focus();$('#parentId').val(-1);">回复</span>
								</div>
							</div>
						</div>
						<div class="tiezi-comment" th:if="${not #lists.isEmpty(postDetail.commentList)}" th:each="comment,iterStat:${postDetail.commentList}">
							<div class="tiezi-box main clear">
								<div class="left">
									<div class="landlord" th:if="${comment.userId==postDetail.userId}"></div>
									<div class="avatar">
										<a th:href="'/user/'+${comment.userId}" target="_blank">
											<span class="vip-icon" th:if="${comment.user.userGrade==1}"></span>
											<img th:src="${thUtil.formatUserImage(comment.user.userImg)}" class="avatar opacity" width="50" height="50">
										</a>
									</div>
									<div class="name"><a th:href="'/user/'+${comment.userId}" target="_blank" th:text="${comment.user.nickName}">unknow</a></div>

									<div class="info">
									</div>

								</div>
								<div class="right">
									<div class="tiezi-box-content">
										<th:block th:utext="${comment.commentContent}">
											此内容由系统生成。。。
										</th:block>
									</div>
									<div class="tiezi-box-footer clear">
										<span th:text="${thUtil.formatPublishDate(comment.createTime)}">1周前</span>
										<!--<span>阅读： 1.6k</span>-->
										<span th:text="${iterStat.count+1}+'楼'">1楼</span>
										<span class="comment" onclick="$('html,body').animate({scrollTop:$('#tiezi-comment-editor-dom').offset().top}, 800);ue.focus();">回复</span>
									</div>
								</div>
							</div>
						</div>


						<div id="tiezi-comment-editor-dom"></div>
						<div class="tiezi-comment-editor-box">
							<th:block th:switch="${#configUtil.getConfigValue('gobalCommentState')}">
								<th:block th:case="'1'">
									<th:block th:if="${postDetail.commentState==1}">
										<div class="javabb-tips" th:if="${session.sessionUser==null}">
											<p>  请登录之后再进行评论  </p>
											<div class="login-btn opacity" th:onclick="|showLoginForm()|">登陆</div>
										</div>
										<div class="editor" th:unless="${session.sessionUser==null}">
											<script id="editor" type="text/plain" style="width: 100%;height:200px;"></script>
											<!--<div th:if="${session.sessionUser==null}" style="background-color: white;font-size:26px;position: absolute;left: 17px;top: 46px;width: 802px; height: calc(100% - 86px); z-index: 10000;text-align: center;line-height: 188px;">
												登陆才能回复
											</div>-->
											<div class="javabb-comment-btn"
												 th:onclick="|javabb_comment_post(${postDetail.postId},${postDetail.catalogId})|">回  复
											</div>
										</div>

									</th:block>
										<div class="javabb-tips" th:if="${postDetail.commentState==0}">
											<p>  帖子没有开启评论功能  </p>
										</div>
								</th:block>
								<th:block th:case="'0'">
									<div class="javabb-tips">
										<p>  网站评论功能关闭  </p>
									</div>
								</th:block>
							</th:block>
						</div>
					</div>

				</div>
				<!--	articleDetail right	-->
				<div class="layui-col-md3">
					<div class="tiezi-main" style="padding-top: 0px !important;">
						<div class="tiezi-sidebox-right" style="position: relative; overflow: visible; box-sizing: border-box; min-height: 388px;">
							<div class="SidebarFixed" style="padding-top: 0px; padding-bottom: 1px; position: fixed; transform: translateY(80px); top: 0px;">
								<div class="side-box">
									<div class="widget-catalog-info-avatar">
										<a th:href="'/catalog/'+${postDetail.catalogId}">
											<img th:src="${postDetail.catalog.catalogImage}" class="avatar opacity">
										</a>
									</div>
									<div class="widget-catalog-info-name">
										<a th:href="'/catalog/'+${postDetail.catalogId}" th:text="${postDetail.catalog.catalogName}">Javabb</a>
									</div>
									<div class="widget-catalog-info-number">
										<li><span>今日</span> <em th:text="${postDetail.catalog.todayCount==null?0:postDetail.catalog.todayCount}">1</em></li>
										<li><span>帖子</span> <em th:text="${postDetail.catalog.postCount}">123</em></li>
										<li><span>互动</span> <em th:text="${postDetail.catalog.commentCount==null?0:postDetail.catalog.commentCount}">123</em></li>
									</div>
								</div>
								<button type="button" class="side-btn btn-primary" th:data-id="${postDetail.catalogId}" onclick="publish(this.getAttribute('data-id'))">我要发帖</button>
								<!--<button type="button" class="side-btn btn-outline-primary">私信</button>-->
								<div th:replace="web/layout/sidebar::recommenedBar"></div>


							</div>
						</div>



					</div>
				</div>

			</div>

		</div>
		<!--	contianer end	-->
<!--	底部版权		-->
<div th:replace="web/layout/footer::footer"></div>
<!--	搜索		-->
<div th:replace="web/layout/common::pop-search"></div>
<!--	右边工具栏	-->
<div th:replace="web/layout/common::right-bar"></div>
<!--	引入JS	-->
<div th:replace="web/common/fragment::js"></div>
<script type="text/javascript" th:inline="javascript">
	var ue;
	//只有网站评论功能开启和文章评论功能开启同时满足，才加载评论框
	var commentProver = [[ ${#configUtil.getConfigValue('gobalCommentState')=='1' and postDetail.commentState==1 and session.sessionUser!=null}]];
	function init(){
		if(commentProver){
			 ue = UE.getEditor('editor',{
				toolbars:[
					[
						'bold','italic','forecolor','backcolor','|',
						'indent','justifyleft','justifycenter','|','insertcode'//全屏
					]
				],
				textarea:'content'
				// readonly : true
			});
		}

	}
	init();

</script>
<div th:replace="web/common/fragment::post"></div>

</body>
</html>
